<template>
  <view v-if="src">
    <!-- #ifdef H5 -->
    <!-- <iframe width="100%" height="100%" :src="src" :title="title" /> -->
    <!-- #endif -->
    <!-- #ifndef H5 -->
    <web-view :webview-styles="wbStyles" :src="src" :fullscreen="false" :update-title="false" @load="changeTitle" />
    <!-- #endif -->
  </view>
</template>
 
<script>
export default {
  data() {
    return {
      title: '',
      src: '',
      wbStyles: {
        width: '100%',
        height: '100%',
      },
    }
  },
  onLoad(option) {
    this.title = option.title? option.title:'详情'
    this.src =  option.src? decodeURIComponent(option.src) : null
	
	console.log(option.src)
	
	// #ifdef H5
	console.log("======323")
	this.redirectH5Page()
	// #endif
	console.log(this.src)
  },
  methods: {
	  changeTitle() {
		   
	   console.log("21123", this.title)
	   setTimeout(() => {
	   console.log("21423", this.title)
		   uni.setNavigationBarTitle({
			title: this.title
		   })
	   }, 5000)
	  },
	  redirectH5Page() {
		// location.href = this.src
		window.open(this.src, '_blank');
	  }
  }
}
</script>